import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);
import SecureLS from "secure-ls";
import persistedState from 'vuex-persistedstate'
import player from './modules/player'

var ls = new SecureLS({
	encodingType: "aes", //加密类型
	isCompression: false, //是否压缩
	encryptionSecret : 'removeItem: (key) => ls.remove(key)'
});

const store = new Vuex.Store({
	state: {

	},
	modules: {
		player
	},
	mutations : {
		
	},
	plugins: [persistedState({
		key: "userGameData",
		// storage: {
		// 	getItem: (key) => ls.get(key),
		// 	setItem: (key, value) => ls.set(key, value),
		// 	removeItem: (key) => ls.remove(key),
		// },
		reducer(val)  {
			return {
				player : val.player
			}
		}
	})],
})

export default store